<?php
namespace app\api\controller;

use app\BaseController;
use app\model\Nav as SelfModel;

use think\facade\Cookie;
use think\Response;
use think\Request;
class Nav extends Base
{


    public function initialize()
    {
        parent::initialize();
        $this->model = "\app\model\Nav";
        $this->list_rows = 10;
        $this->msg = '导航';
        $this->order = ['sort'=>'asc','id'=>'desc'];
        $this->status = [['status','=','1']];
    }

    public function all(Request $request)
    {
        $notice = (new \app\model\Notice())->where([
            ['status', '=', 1],
            ['index_status', '=', 1]
        ])->field('id,title,create_time')->order(['sort' => 'asc', 'id' => 'desc'])->select();
        $nav_data = (new \app\model\Nav())->where([
            ['status', '=', 1],
        ])->order(['sort' => 'asc', 'id' => 'desc'])->select();
        $banner = \app\model\Banner::where('type_id', 10)->order(['sort' => 'asc', 'id' => 'desc'])->select();
        return ['code' => 200, 'msg' => '', 'data' => $nav_data, 'notic' => $notice, 'banner' => $banner];
    }




}
